home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 14
/
Aminet 14 - Oct 1996.iso
/
TCalc
/
Français
/
TurboCalc3.5Demo
/
Programmer
/
Examples.lha
/
demo_function.tclib.s
next >
Wrap
Text File
|
1994-11-10
|
3KB
|
121 lines
*********************************************
** Example for a very simple 'external funtions' class.
** For a description of the implemented functions/macors see
** the included TurboCalc-Sheet 'Fkt_TCLibs.TCD'
**
** (c) 1994 by Michael Friedrich
** All Rights Reserved.
**
** You may use parts of this code to create your own private TCLibs.
** You are also allowed to publish these TCLibs as long as I will get
** a copy them.
**
include "tclib.i"
startall:
moveq #-13,d0 ; if user tries to start this lib!
rts ; (need -13 to identify TClibs!)
dc.l 'TCLB' ; TurboCalc-Lib - this field is used to identify
; TClibs and to link them in memory (i.e. that
; this entry is used and thus changed by TC
; to keep a list of all already loaded libs!)
dc.l 'FNCT'
dc.w 1,0 ; Version, Revision
dc.l txt_name
dc.l txt_ver
dc.l txt_author
dc.l 0 ; flags - reserved
dc.l 0 ; reserved
dc.l 0 ; reserved
* default-routines
dc.l 0 ; init
dc.l 0 ; exit
dc.l 0 ; flush
dc.l 0
*
dc.l 0 ; flags
dc.l 5
dc.l demo_fncdefault
dc.l demo_function1
dc.l demo_function2
dc.l demo_function3
dc.l demo_function4
dc.l demo_function5
txt_name: dc.b 'Function/Macro-TCLib Example',0
txt_ver: dc.b '$VER: SimpleFunctions V1.0 (01.11.94)',0
txt_author: dc.b '© 1994 Michael Friedrich',0
cnop 0,2
*** unknown function - simply return function-number as init!
demo_fncdefault:
move.l d7,d0
moveq #TYPE_NUM,d2
rts
*** val1+val (as long)
demo_function1:
move.l d2,d0
add.l d5,d0
moveq #TYPE_NUM,d2
rts
*** val1*val2 (as long)
demo_function2:
move.l d2,d0
mulu d5,d0
moveq #TYPE_NUM,d2
rts
*** val1*val (as float)
demo_function3:
moveq #CDX_Mul,d7
XSR Call_CDX
moveq #TYPE_FLOAT,d2
rts
*** uppercase(text) - starting at val1, max. val2 chars (0=all)!
demo_function4:
move.l a0,d0
beq.s 90$
XSR DuplicateTEXT
move.l a0,d0
beq.s 90$
* skip first part
subq.w #2,d2
bmi.s 22$
20$ tst.b (a0)+
beq.s 90$
21$ dbra d2,20$
22$
*
subq.w #1,d5
move.l d0,d2
30$ move.b (a0),d0
beq.s 39$
XSR UpperCaseD0
move.b d0,(a0)+
dbra d5,30$
39$ move.l d2,d0
*
90$ moveq #TYPE_TEXT,d2
rts
******************************
demo_function5: ; it's a macro!
* simple macro, blinking the LED.
10$ move.l d5,d0
bchg #1,$bfe001
20$ subq.l #1,d0
bpl.s 20$
subq.l #1,d2
bpl.s 10$
moveq #0,d0
moveq #TYPE_NUM,d2
rts
END